$(function() {
  $("#login").click(function(){
    $.ajax({
      type: "POST",
      dataType: "json",
      url: "/index/signin" ,//url
      data: {username:$("#account").val(),password:$("#password").val()},
      success: function (result) {
        if (result.code == 0) {
          window.location.href = result.url;
        } else {
          $("#login_form").removeClass('shake_effect');
          setTimeout(function()
          {
            $("#login_form").addClass('shake_effect')
          },1);
        }
      },
      error : function() {
        alert("异常！");
      }
    });
    return false;
  })
  $('.installapp').on('click', function() {
    var obj = $(this);
    $.ajax({
      type: "get",
      dataType: "json",
      url: "/index/installapp/"+$(this).attr('data-identifier'),
      success: function (result) {
        if (result.code == 0) {
          obj.addClass("disabled");
          obj.html('<span class="glyphicon glyphicon-ok"></span> 安装成功');
        } else {
          alert(result.msg);
        }
      },
      error : function() {
        alert("异常！");
      }
    });
    return false;
  });
})
